package utils

import (
	"encoding/json"
	"fmt"
	"sync"
)

type Item struct {
	ParentDicId string `json:"parentDicId"`
	DicValue    string `json:"dicValue"`
	DicCode     string `json:"dicCode"`
}

type List struct {
	List []Item `json:"list"`
}

var mu sync.Mutex
var i int

func GenerateData() []byte {
	mu.Lock()
	i++
	sendData := List{
		List: []Item{
			{
				ParentDicId: "SDi3f5iE1D9P",
				DicValue:    fmt.Sprintf("呵呵%d", i),
				DicCode:     fmt.Sprintf("%d", i),
			},
		},
	}
	mu.Unlock()
	data, _ := json.Marshal(sendData)
	return data
}
